home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / LITTLE / P3SRC.ZIP / ATARI / FRAME.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-19  |  22.7 KB  |  759 lines

  1. /****************************************************************************
  2. *                   frame.h
  3. *
  4. *  This header file is included by all C modules in POV-Ray. It defines all
  5. *  globally-accessible types and constants.
  6. *
  7. *  from Persistence of Vision(tm) Ray Tracer
  8. *  Copyright 1996 Persistence of Vision Team
  9. *---------------------------------------------------------------------------
  10. *  NOTICE: This source code file is provided so that users may experiment
  11. *  with enhancements to POV-Ray and to port the software to platforms other
  12. *  than those supported by the POV-Ray Team.  There are strict rules under
  13. *  which you are permitted to use this file.  The rules are in the file
  14. *  named POVLEGAL.DOC which should be distributed with this file. If
  15. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  16. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  17. *  Forum.  The latest version of POV-Ray may be found there as well.
  18. *
  19. * This program is based on the popular DKB raytracer version 2.12.
  20. * DKBTrace was originally written by David K. Buck.
  21. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  22. *
  23. * Modified by Andreas Dilger to add PNG file format support 05/09/95
  24. *
  25. *****************************************************************************/
  26.  
  27. #ifndef FRAME_H
  28. #define FRAME_H
  29.  
  30. /* Generic header for all modules */
  31.  
  32. #include <math.h>
  33. #include <stdio.h>
  34. #include <string.h>
  35. #include <limits.h>
  36. #include <tos.h>
  37. #include "config.h"
  38.  
  39.  
  40. #ifndef READ_ENV_VAR
  41. #define READ_ENV_VAR Warning(0.0,"Environment variable not implemented on this platform.\n");
  42. #endif
  43.  
  44. #ifndef PROCESS_POVRAY_INI
  45. #define PROCESS_POVRAY_INI Warning(0.0,"Reading 'povray.ini' not implemented on this platform.\n");
  46. #endif
  47.  
  48. #ifndef POV_PRE_SHUTDOWN
  49. #define POV_PRE_SHUTDOWN
  50. #endif
  51.  
  52. #ifndef POV_POST_SHUTDOWN
  53. #define POV_POST_SHUTDOWN
  54. #endif
  55.  
  56. #ifndef POV_PRE_RENDER
  57. #define POV_PRE_RENDER
  58. #endif
  59.  
  60. #ifndef ALT_WRITE_INI_FILE
  61. #define ALT_WRITE_INI_FILE
  62. #endif
  63.  
  64. #ifndef CONFIG_MATH
  65. #define CONFIG_MATH
  66. #endif
  67.  
  68. #ifndef CONST
  69. #define CONST
  70. #endif
  71.  
  72. #ifndef EPSILON
  73. #define EPSILON 1.0e-10
  74. #endif
  75.  
  76. /* POV_NAME_MAX is for file systems that have a separation of the filename
  77. ** into name.ext.  The POV_NAME_MAX is the name part.  FILE_NAME_LENGTH
  78. ** is the sum of name + ext */
  79. #ifndef POV_NAME_MAX
  80. #define POV_NAME_MAX 8
  81. #endif
  82.  
  83. #ifndef FILE_NAME_LENGTH
  84. #define FILE_NAME_LENGTH 150
  85. #endif
  86.  
  87. #ifndef HUGE_VAL
  88. #define HUGE_VAL 1.0e+17
  89. #endif
  90.  
  91. /* Maximum lengths of a bounding box. */
  92.  
  93. #ifndef BOUND_HUGE
  94. #define BOUND_HUGE 2.0e10
  95. #endif
  96.  
  97. /*
  98.  * [DB 8/94]
  99.  *
  100.  * If the width of a bounding box in one dimension is greater than
  101.  * the critical length, the bounding box should be set to infinite.
  102.  */
  103.  
  104. #ifndef CRITICAL_LENGTH
  105. #define CRITICAL_LENGTH 1.0e6
  106. #endif
  107.  
  108. #ifndef DBL_FORMAT_STRING
  109. #define DBL_FORMAT_STRING "%lf"
  110. #endif
  111.  
  112. #ifndef DEFAULT_OUTPUT_FORMAT
  113. #define DEFAULT_OUTPUT_FORMAT   't'
  114. #endif
  115.  
  116. #ifndef READ_SYS_IMAGE
  117. #define READ_SYS_IMAGE(i,n) Read_Targa_Image((i),(n))
  118. #endif
  119.  
  120. #ifndef GET_SYS_FILE_HANDLE
  121. #define GET_SYS_FILE_HANDLE Get_Targa_File_Handle
  122. #endif
  123.  
  124. #ifndef SYS_DEF_EXT
  125. #define SYS_DEF_EXT ".tga"
  126. #endif
  127.  
  128. #ifndef FILENAME_SEPARATOR
  129. #define FILENAME_SEPARATOR '/'
  130. #endif
  131.  
  132. #ifndef DRIVE_SEPARATOR
  133. #define DRIVE_SEPARATOR ':'
  134. #endif
  135.  
  136. #ifndef READ_FILE_STRING
  137. #define READ_FILE_STRING "rb"
  138. #endif
  139.  
  140. #ifndef WRITE_FILE_STRING
  141. #define WRITE_FILE_STRING "wb"
  142. #endif
  143.  
  144. #ifndef APPEND_FILE_STRING
  145. #define APPEND_FILE_STRING "ab"
  146. #endif
  147.  
  148. #ifndef DELETE_FILE_ERR
  149. #define DELETE_FILE_ERR -1
  150. #endif
  151.  
  152. #ifndef DELETE_FILE
  153. #define DELETE_FILE(name) unlink(name)
  154. #endif
  155.  
  156. #ifndef RENAME_FILE_ERR
  157. #define RENAME_FILE_ERR -1
  158. #endif
  159.  
  160. #ifndef RENAME_FILE
  161. #define RENAME_FILE(orig,new) rename(orig,new)
  162. #endif
  163.  
  164. #ifndef NORMAL
  165. #define NORMAL '0'
  166. #endif
  167.  
  168. #ifndef GREY
  169. #define GREY   'G'
  170. #endif
  171.  
  172. #ifndef DEFAULT_DISPLAY_GAMMA
  173. #define DEFAULT_DISPLAY_GAMMA 2.2
  174. #endif
  175.  
  176. #ifndef DEFAULT_ASSUMED_GAMMA
  177. #define DEFAULT_ASSUMED_GAMMA 1.0
  178. #endif
  179.  
  180. #ifndef START_TIME
  181. #define START_TIME time(&tstart);     
  182. #endif
  183.  
  184. #ifndef STOP_TIME
  185. #define STOP_TIME  time(&tstop);
  186. #endif
  187.  
  188. #ifndef TIME_ELAPSED
  189. #define TIME_ELAPSED difftime (tstop, tstart);
  190. #endif
  191.  
  192. #ifndef PRECISION_TIMER_AVAILABLE
  193. #define PRECISION_TIMER_AVAILABLE 0
  194. #endif
  195.  
  196. #ifndef PRECISION_TIMER_INIT
  197. #define PRECISION_TIMER_INIT
  198. #endif
  199.  
  200. #ifndef PRECISION_TIMER_START
  201. #define PRECISION_TIMER_START ;
  202. #endif
  203.  
  204. #ifndef PRECISION_TIMER_STOP
  205. #define PRECISION_TIMER_STOP
  206. #endif
  207.  
  208. #ifndef PRECISION_TIMER_COUNT
  209. #define PRECISION_TIMER_COUNT 0
  210. #endif
  211.  
  212. #ifndef STARTUP_POVRAY
  213. #define STARTUP_POVRAY
  214. #endif
  215.  
  216. #ifndef PRINT_OTHER_CREDITS
  217. #define PRINT_OTHER_CREDITS
  218. #endif
  219.  
  220. #ifndef TEST_ABORT
  221. #define TEST_ABORT
  222. #endif
  223.  
  224. #ifndef FINISH_POVRAY                /* This comment has been added */
  225. #define FINISH_POVRAY(n) exit(n);    /* to make doubly sure that these */
  226. #endif                               /* lines get patched */
  227.  
  228. #ifdef COOPERATE                     /* this allows code that uses COOPERATE */
  229. #define COOPERATE_0     COOPERATE    /* to continue to work with the new form */
  230. #define COOPERATE_1     COOPERATE
  231. #endif
  232.  
  233. #ifndef COOPERATE_0                  
  234. #define COOPERATE_0
  235. #endif
  236.  
  237. #ifndef COOPERATE_1
  238. #define COOPERATE_1
  239. #endif
  240.  
  241. #ifndef POV_PRE_PIXEL
  242. #define POV_PRE_PIXEL(x,y,c)
  243. #endif
  244.  
  245. #ifndef POV_POST_PIXEL
  246. #define POV_POST_PIXEL(x,y,c)
  247. #endif
  248.  
  249. #ifndef DBL
  250. #define DBL double
  251. #endif
  252.  
  253. #ifndef SNGL
  254. #define SNGL float
  255. #endif
  256.  
  257. #ifndef COLC
  258. #define COLC float
  259. #endif
  260.  
  261. #ifndef PARAMS
  262. #define PARAMS(x) x
  263. #endif
  264.  
  265. #ifndef ANSIFUNC
  266. #define ANSIFUNC 1
  267. #endif
  268.  
  269. #ifndef M_PI
  270. #define M_PI 3.1415926535897932384626
  271. #endif
  272.  
  273. #ifndef M_PI_2
  274. #define M_PI_2 1.57079632679489661923
  275. #endif
  276.  
  277. #ifndef TRUE
  278. #define TRUE 1
  279. #define FALSE 0
  280. #endif
  281.  
  282. #ifndef IFF_SWITCH_CAST
  283. #define IFF_SWITCH_CAST (int)
  284. #endif
  285.  
  286. #ifndef PRINT_CREDITS
  287. #define PRINT_CREDITS Print_Credits();
  288. #endif
  289.  
  290. #ifndef PRINT_STATS
  291. #define PRINT_STATS(a) Print_Stats(a);
  292. #endif
  293.  
  294. #ifndef WAIT_FOR_KEYPRESS
  295. #define WAIT_FOR_KEYPRESS
  296. #else
  297. #define WAIT_FOR_KEYPRESS_EXISTS
  298. #endif
  299.  
  300. /*
  301.  * The GET_KEY macro returns the key pressed by the user.
  302.  * The function used to get the pressed key has to be specified
  303.  * in the machine dependent config.h file.
  304.  */
  305. #ifndef GET_KEY
  306. #define GET_KEY
  307. #else
  308. #define GET_KEY_EXISTS
  309. #endif
  310.  
  311. #ifndef CDECL
  312. #define CDECL
  313. #endif
  314.  
  315. #ifndef MAX_BUFSIZE
  316. #define MAX_BUFSIZE INT_MAX
  317. #endif
  318.  
  319. /* If compiler version is undefined, then make it 'u' for unknown */
  320. #ifndef COMPILER_VER
  321. #define COMPILER_VER ".u"
  322. #endif
  323.  
  324. #ifndef QSORT
  325. #define QSORT(a,b,c,d) qsort((a),(b),(c),(d))
  326. #endif
  327.  
  328. #ifndef MAIN_RETURN_TYPE
  329. #define MAIN_RETURN_TYPE void
  330. #endif
  331.  
  332. #ifndef MAIN_RETURN_STATEMENT
  333. #define MAIN_RETURN_STATEMENT
  334. #endif
  335.  
  336. #ifndef POV_RAND
  337. #define POV_RAND() POV_Std_rand()
  338. #endif
  339.  
  340. #ifndef POV_SRAND
  341. #define POV_SRAND(i) POV_Std_srand(i)
  342. #endif
  343.  
  344. #ifndef POV_BANNER
  345. #define POV_BANNER(s) POV_Std_Banner(s)
  346. #endif
  347.  
  348. #ifndef POV_WARNING
  349. #define POV_WARNING(s) POV_Std_Warning(s)
  350. #endif
  351.  
  352. #ifndef POV_RENDER_INFO
  353. #define POV_RENDER_INFO(s) POV_Std_Render_Info(s)
  354. #endif
  355.  
  356. #ifndef POV_STATUS_INFO
  357. #define POV_STATUS_INFO(s) POV_Std_Status_Info(s)
  358. #endif
  359.  
  360. #ifndef POV_DEBUG_INFO
  361. #define POV_DEBUG_INFO(s) POV_Std_Debug_Info(s)
  362. #endif
  363.  
  364. #ifndef POV_FATAL
  365. #define POV_FATAL(s) POV_Std_Fatal(s)
  366. #endif
  367.  
  368. #ifndef POV_STATISTICS
  369. #define POV_STATISTICS(s) POV_Std_Statistics(s)
  370. #endif
  371.  
  372. #ifndef POV_DISPLAY_INIT
  373. #define POV_DISPLAY_INIT(w,h,f) POV_Std_Display_Init((w),(h));
  374. #endif
  375.  
  376. #ifndef POV_DISPLAY_CLOSE
  377. #define POV_DISPLAY_CLOSE POV_Std_Display_Close();
  378. #endif
  379.  
  380. #ifndef POV_DISPLAY_FINISHED
  381. #define POV_DISPLAY_FINISHED POV_Std_Display_Finished();
  382. #endif
  383.  
  384. #ifndef POV_DISPLAY_PLOT
  385. #define POV_DISPLAY_PLOT(x,y,r,g,b,a) POV_Std_Display_Plot((x),(y),(r),(g),(b),(a));
  386. #endif
  387.  
  388. #ifndef POV_DISPLAY_PLOT_RECT
  389. #define POV_DISPLAY_PLOT_RECT(x1,x2,y1,y2,r,g,b,a) POV_Std_Display_Plot_Rect((x1),(x2),(y1),(y2),(r),(g),(b),(a));
  390. #endif
  391.  
  392. #ifndef POV_DISPLAY_PLOT_BOX
  393. #define POV_DISPLAY_PLOT_BOX(x1,y1,x2,y2,r,g,b,a) POV_Std_Display_Plot_Box((x1),(y1),(x2),(y2),(r),(g),(b),(a));
  394. #endif
  395.  
  396. #ifndef POV_SPLIT_PATH
  397. #define POV_SPLIT_PATH(s,p,f) POV_Split_Path((s),(p),(f))
  398. #endif
  399.  
  400. #ifndef SPLIT_TIME
  401. #define SPLIT_TIME(d,h,m,s) POV_Std_Split_Time ((d),(h),(m),(s))
  402. #endif
  403.  
  404. #ifndef NEW_LINE_STRING
  405. #define NEW_LINE_STRING "\n"
  406. #endif
  407.  
  408. /* These values determine the minumum and maximum distances
  409.    that qualify as ray-object intersections */
  410. #define Small_Tolerance 0.001
  411. #define Max_Distance 1.0e7
  412.  
  413.  
  414.  
  415. /*****************************************************************************
  416.  *
  417.  * MEMIO.C Memory macros
  418.  *
  419.  *****************************************************************************/
  420.  
  421. #ifndef __FILE__
  422. #define __FILE__ ""
  423. #endif
  424.  
  425. #ifndef __LINE__
  426. #define __LINE__ (-1)
  427. #endif
  428.  
  429. #ifndef POV_MALLOC
  430. #define POV_MALLOC(size,msg)        pov_malloc ((size), __FILE__, __LINE__, (msg))
  431. #endif
  432.  
  433. #ifndef POV_CALLOC
  434. #define POV_CALLOC(nitems,size,msg) pov_calloc ((nitems), (size), __FILE__, __LINE__, (msg))
  435. #endif
  436.  
  437. #ifndef POV_REALLOC
  438. #define POV_REALLOC(ptr,size,msg)   pov_realloc ((ptr), (size), __FILE__, __LINE__, (msg))
  439. #endif
  440.  
  441. #ifndef POV_FREE
  442. #define POV_FREE(ptr)               pov_free ((void *)(ptr), __FILE__, __LINE__)
  443. #endif
  444.  
  445. #ifndef POV_SHELLOUT
  446. #define POV_SHELLOUT(string) pov_shellout(string)
  447. #endif
  448.  
  449. #ifndef POV_MAX_CMD_LENGTH
  450. #define POV_MAX_CMD_LENGTH 250
  451. #endif
  452.  
  453. #ifndef POV_SYSTEM
  454. #define POV_SYSTEM(string) system(string)
  455. #endif
  456.  
  457.  
  458. /*****************************************************************************
  459.  *
  460.  * Typedefs that need to be known here.
  461.  *
  462.  *****************************************************************************/
  463.  
  464. typedef struct Object_Struct OBJECT;
  465. typedef struct Ray_Struct RAY;
  466. typedef struct istack_struct ISTACK;
  467. typedef struct istk_entry INTERSECTION;
  468.  
  469.  
  470.  
  471. /*****************************************************************************
  472.  *
  473.  * Scalar, color and vector stuff.
  474.  *
  475.  *****************************************************************************/
  476.  
  477. typedef DBL UV_VECT [2];
  478. typedef DBL VECTOR [3];
  479. typedef DBL MATRIX [4][4];
  480. typedef DBL EXPRESS [5];
  481. typedef COLC COLOUR [5];
  482. typedef COLC RGB [3];
  483. typedef int TOKEN;
  484. typedef int CONSTANT;
  485. typedef short WORD;
  486.  
  487. /* Stuff for bounding boxes. */
  488.  
  489. #define BBOX_VAL SNGL
  490.  
  491. typedef BBOX_VAL BBOX_VECT[3];
  492.  
  493. #define Assign_BBox_Vect(d,s) \
  494. { \
  495.   (d)[X] = (s)[X]; \
  496.   (d)[Y] = (s)[Y]; \
  497.   (d)[Z] = (s)[Z]; \
  498. }
  499.  
  500. #define Make_BBox(BBox, llx, lly, llz, lex, ley, lez) \
  501. { \
  502.   (BBox).Lower_Left[X] = (BBOX_VAL)(llx); \
  503.   (BBox).Lower_Left[Y] = (BBOX_VAL)(lly); \
  504.   (BBox).Lower_Left[Z] = (BBOX_VAL)(llz); \
  505.   (BBox).Lengths[X] = (BBOX_VAL)(lex); \
  506.   (BBox).Lengths[Y] = (BBOX_VAL)(ley); \
  507.   (BBox).Lengths[Z] = (BBOX_VAL)(lez); \
  508. }
  509.  
  510. #define Make_BBox_from_min_max(BBox, mins, maxs) \
  511. { \
  512.   (BBox).Lower_Left[X] = (BBOX_VAL)(mins[X]); \
  513.   (BBox).Lower_Left[Y] = (BBOX_VAL)(mins[Y]); \
  514.   (BBox).Lower_Left[Z] = (BBOX_VAL)(mins[Z]); \
  515.   (BBox).Lengths[X] = (BBOX_VAL)(maxs[X]-mins[X]); \
  516.   (BBox).Lengths[Y] = (BBOX_VAL)(maxs[Y]-mins[Y]); \
  517.   (BBox).Lengths[Z] = (BBOX_VAL)(maxs[Z]-mins[Z]); \
  518. }
  519.  
  520. #define Make_min_max_from_BBox(mins, maxs, BBox) \
  521. { \
  522.   (mins)[X] = (BBox).Lower_Left[X]; \
  523.   (mins)[Y] = (BBox).Lower_Left[Y]; \
  524.   (mins)[Z] = (BBox).Lower_Left[Z]; \
  525.   (maxs)[X] = (mins)[X] + (BBox).Lengths[X]; \
  526.   (maxs)[Y] = (mins)[Y] + (BBox).Lengths[Y]; \
  527.   (maxs)[Z] = (mins)[Z] + (BBox).Lengths[Z]; \
  528. }
  529.  
  530. /* Stuff for SNGL vectors. */
  531.  
  532. typedef SNGL SNGL_VECT[3];
  533.  
  534. #define Assign_SNGL_Vect(d,s) \
  535. { \
  536.   (d)[X] = (s)[X]; \
  537.   (d)[Y] = (s)[Y]; \
  538.   (d)[Z] = (s)[Z]; \
  539. }
  540.  
  541.  
  542. /* Vector array elements. */
  543. #define U 0
  544. #define V 1
  545.  
  546. #define X 0
  547. #define Y 1
  548. #define Z 2
  549. #define T 3
  550.  
  551.  
  552. /* Colour array elements. */
  553.  
  554. #define RED    0
  555. #define GREEN  1
  556. #define BLUE   2
  557. #define FILTER 3
  558. #define TRANSM 4
  559.  
  560. /* Macros to manipulate scalars, vectors, and colors. */
  561.  
  562. #define Destroy_Float(x)    if ((x)!=NULL) POV_FREE(x)
  563.  
  564. #define Assign_Vector(d,s)  memcpy((d),(s),sizeof(VECTOR))
  565. #define Destroy_Vector(x)   if ((x)!=NULL) POV_FREE(x)
  566.  
  567. #define Assign_UV_Vect(d,s) memcpy((d),(s),sizeof(UV_VECT))
  568. #define Destroy_UV_Vect(x)  if ((x)!=NULL) POV_FREE(x)
  569.  
  570. #define Assign_Colour(d,s)  memcpy((d),(s),sizeof(COLOUR))
  571. #define Make_Colour(c,r,g,b) {(c)[RED]=(r);(c)[GREEN]=(g);(c)[BLUE]=(b);(c)[FILTER]=0.0;(c)[TRANSM]=0.0;}
  572. #define Make_ColourA(c,r,g,b,a,t) {(c)[RED]=(r);(c)[GREEN]=(g);(c)[BLUE]=(b);(c)[FILTER]=(a);(c)[TRANSM]=t;}
  573. #define Make_Vector(v,a,b,c) { (v)[X]=(a);(v)[Y]=(b);(v)[Z]=(c); }
  574. #define Destroy_Colour(x) if ((x)!=NULL) POV_FREE(x)
  575. #define Make_RGB(c,r,g,b) {(c)[RED]=(r);(c)[GREEN]=(g);(c)[BLUE]=(b);}
  576.  
  577.  
  578.  
  579. /*****************************************************************************
  580.  *
  581.  * Hi-resolution counter.
  582.  *
  583.  *****************************************************************************/
  584.  
  585. /* Define counter resolution. */
  586.  
  587. #define LOW_RESOLUTION  1
  588. #define HIGH_RESOLUTION 2
  589.  
  590. #define COUNTER_RESOLUTION HIGH_RESOLUTION
  591.  
  592. #if COUNTER_RESOLUTION == HIGH_RESOLUTION
  593.  
  594. /* 64bit counter. */
  595.  
  596. typedef struct Counter_Struct COUNTER;
  597.  
  598. struct Counter_Struct
  599. {
  600.   unsigned long high, low;
  601. };
  602.  
  603. #define DBL_Counter(x)     ( (x).low + Sqr(65536.0)*(DBL)(x).high )
  604. #define Long_To_Counter(i,x) { (x).low = i; (x).high = 0; }
  605. #define Init_Counter(x)     { (x).high = (x).low = 0L; }
  606. #define Test_Zero_Counter(x) (((x).low == 0L) && ((x).high == 0L))
  607. #define Increase_Counter(x) { if ((++(x).low) == 0L) { (x).high++; } }
  608. #define Add_Counter(x, a, b) \
  609. { \
  610.   (x).low = (a).low + (b).low; \
  611.   \
  612.   if (((x).low < (a).low) || ((x).low < (b).low)) \
  613.   { \
  614.     /* add with carry */ \
  615.     (x).high = (a).high + (b).high + 1; \
  616.   } \
  617.   else \
  618.   { \
  619.     /* add without carry */ \
  620.     (x).high = (a).high + (b).high; \
  621.   } \
  622. }
  623.  
  624. #else
  625.  
  626. /* 32bit counter. */
  627.  
  628. typedef unsigned long COUNTER;
  629.  
  630. #define DBL_Counter(x)     ( (DBL)(x) )
  631. #define Long_To_Counter(i,x) { (x) = i; }
  632. #define Init_Counter(x)      { (x) = 0L; }
  633. #define Increase_Counter(x)  { (x)++; }
  634. #define Test_Zero_Counter(x) ((x) == 0L)
  635. #define Add_Counter(x, a, b) { (x) = (a) + (b); }
  636.  
  637. #endif
  638.  
  639.  
  640.  
  641. /*****************************************************************************
  642.  *
  643.  * Bounding box stuff (see also BOUND.H).
  644.  *
  645.  *****************************************************************************/
  646.  
  647. typedef struct Bounding_Box_Struct BBOX;
  648.  
  649. struct Bounding_Box_Struct
  650. {
  651.   BBOX_VECT Lower_Left, Lengths;
  652. };
  653.  
  654.  
  655.  
  656. /*****************************************************************************
  657.  *
  658.  * Transformation stuff.
  659.  *
  660.  *****************************************************************************/
  661.  
  662. typedef struct Transform_Struct TRANSFORM;
  663.  
  664. struct Transform_Struct
  665. {
  666.   MATRIX matrix;
  667.   MATRIX inverse;
  668. };
  669.  
  670. #define Destroy_Transform(x) if ((x)!=NULL) POV_FREE(x)
  671.  
  672.  
  673.  
  674. /*****************************************************************************
  675.  *
  676.  * Color map stuff.
  677.  *
  678.  *****************************************************************************/
  679.  
  680. #define MAX_BLEND_MAP_ENTRIES 256
  681.  
  682. typedef struct Blend_Map_Entry BLEND_MAP_ENTRY;
  683. typedef struct Blend_Map_Struct BLEND_MAP;
  684. typedef struct Pattern_Struct TPATTERN;
  685. typedef struct Texture_Struct TEXTURE;
  686. typedef struct Pigment_Struct PIGMENT;
  687. typedef struct Tnormal_Struct TNORMAL;
  688. typedef struct Finish_Struct FINISH;
  689. typedef struct Turb_Struct TURB;
  690. typedef struct Warps_Struct WARP;
  691. typedef struct Halo_Struct HALO;
  692.  
  693. struct Blend_Map_Entry
  694. {
  695.   SNGL value;
  696.   unsigned char Same;
  697.   union
  698.   {
  699.    COLOUR Colour;
  700.    PIGMENT *Pigment;
  701.    TNORMAL *Tnormal;
  702.    TEXTURE *Texture;
  703.    UV_VECT Point_Slope;
  704.   } Vals;
  705. };
  706.  
  707. struct Blend_Map_Struct
  708. {
  709.   short Number_Of_Entries, Transparency_Flag, Type;
  710.   long  Users;
  711.   BLEND_MAP_ENTRY *Blend_Map_Entries;
  712. };
  713.  
  714. #define Make_Blend_Map_Entry(entry,v,s,r,g,b,a,t) \
  715. { \
  716.   (entry).value = (v); \
  717.   (entry).Same = (s); \
  718.   Make_ColourA((entry).Vals.Colour, r, g, b, a, t); \
  719. }
  720.  
  721.  
  722. /*****************************************************************************
  723.  *
  724.  * IFF file stuff.
  725.  *
  726.  *****************************************************************************/
  727.  
  728. typedef struct Image_Colour_Struct IMAGE_COLOUR;
  729.  
  730. typedef struct Image_Line_Struct IMAGE_LINE;
  731.  
  732. struct Image_Colour_Struct
  733. {
  734.   unsigned short Red, Green, Blue, Filter, Transmit;
  735. };
  736.  
  737. struct Image_Line_Struct
  738. {
  739.   unsigned char *red, *green, *blue, *transm;
  740. };
  741.  
  742.  
  743.  
  744. /*****************************************************************************
  745.  *
  746.  * Image stuff.
  747.  *
  748.  *****************************************************************************/
  749.  
  750. /* Legal image attributes. */
  751.  
  752. #define NO_FILE         0x0000
  753. #define GIF_FILE        0x0001
  754. #define POT_FILE        0x0002
  755. #define SYS_FILE        0x0004
  756. #define IFF_FILE        0x0008
  757. #define TGA_FILE        0x0010
  758. #define GRAD_FILE       0x0020
  759. #define PGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM_FILE        0x004_malloc ((siPGM((siPGM_FILE    (x)!=NULL) ((si004_mM_FILE   L) ((si     ;  (x)!=NULF